#include "ParticleSystem.h"
#include "Particle.h"
#include <math.h>

ParticleSystem::ParticleSystem(int NUMParticles)
{
}

void ParticleSystem::changeSize(int NUMParticles)
	{
		numParticles = NUMParticles;
		for(int i = 0; i< numParticles; i++)
		{
			particles.push_back(Particle());
		}
	}

void ParticleSystem::updateSingleParticle(int index, double transX, double transY, double transZ)
{
	particles[index].updateParticle(transX, transY, transZ);
}

void ParticleSystem::setupExplode(int NumParticles)
{
	double speedX, speedY, speedZ;
	numParticles = NumParticles;
	for(int i = 0; i< numParticles; i++)
	{
		particles.push_back(Particle());
		double life  = rand() % 10 + 50;
		for(int j = 0; j<5; j++)
		{
		speedX = rand() % 3;
		}
		for(int j = 0; j<5; j++)
		{
		speedY = rand() % 5;
		}
		for(int j =0; j<5; j++)
		{
		speedZ = rand() % 4;
		}
		particles[i].setLifeSpeed(life, speedX, speedY, speedZ);
	}
}

void ParticleSystem::updateSingleParticleExplode(int index)
{
	particles[index].updateParticleWithSpeed();
}